<?php
include ('ModelConexion.php'); 
?>
 	<!DOCTYPE html>
 	<html>
 	<head>
 		<title></title>
 		<meta charset="utf-8"/>
 	</head>
 	<body>

<?php
class Usuarios extends Conexion
{

	public $M_Username;
	public $M_Password;
	//private $M_tipo;
	public $mensajeL;

	
	
	public function login($User,$Password)
	{	
		if($User != '' && $Password != '')
		{
			$objeto = new Conexion();			
			$consulta = $objeto->consulta("
				SELECT `IDUS`, `COUS`
				FROM `siprest`.`tb_us`
				WHERE IDUS=$User
				AND COUS=$Password
				");

				if($objeto->numero_filas($consulta) == 1)
				{
					

					while($Arreglo= $objeto->f_array($consulta))
					{
						$_SESSION['IDUS'] = $Arreglo['IDUS'];

						header('Location:../Home.php');
					}
					
				}
				else
				{
					?>
					<script type="text/javascript">
					alert("Debe Iniciar Sesión"); 
					window.location="../../index.php";  
					</script>
					
				<?php 
				}

		}
	}
}

?>
	</body>
 	</html>